package cn.bs.busuo.front.content.dao.persist.repository.impl;

import cn.bs.busuo.front.content.dao.persist.mapper.UserCommentHotelMapper;
import cn.bs.busuo.front.content.dao.persist.mapper.UserCommentSightMapper;
import cn.bs.busuo.front.content.dao.persist.repository.UserCommentRepository;
import cn.bs.busuo.front.content.pojo.entity.ContentHotelComment;
import cn.bs.busuo.front.content.pojo.entity.ContentSightComment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @author: Feng
 * @since: 2023/12/9
 */
@Repository
public class UserCommentRepositoryImpl implements UserCommentRepository {

    @Autowired
    private UserCommentHotelMapper userCommentHotelMapper;
    @Autowired
    private UserCommentSightMapper userCommentSightMapper;

    //酒店的文章
    @Override
    public int insertHotelComment(ContentHotelComment contentHotelComment) {
        return userCommentHotelMapper.insert(contentHotelComment);
    }

    //查看酒店文章的一级评论是否存在
    @Override
    public ContentHotelComment selectHotelCommentById(Long id) {
        return userCommentHotelMapper.selectHotelCommentById(id);
    }

    //删除酒店文章评论
    @Override
    public int updateHotelCommentById(Long id) {
        return userCommentHotelMapper.updateHotelCommentById(id);
    }

    //景点文章一级评论
    public int insertSightComment(ContentSightComment contentSightComment) {
        return userCommentSightMapper.insert(contentSightComment);
    }

    //查看景点文章一级评论是否存在
    @Override
    public ContentSightComment selectSightCommentById(Long id) {
        return userCommentSightMapper.selectSightCommentById(id);
    }

    //删除景点文章评论
    @Override
    public int updateSightCommentById(Long id) {
        return userCommentSightMapper.updateSightCommentById(id);
    }


}
